<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>模板字符串</title>
  </head>

  <body>

  </body>
  <script>
    /* 
模板字符串
 1.反引号使用
 2.允许里面有变量
 3.允许换行
*/
    var num = 10;
    let str1 = `
123

456


记得加村粗的才能参加怒好处VB奴的缓存吃醋很粗${num}

`
    console.log(str1);

    /* 
    ES6中的模板字符串：双引号，单引号，新增反引号
    */
    //1.可以定义字符串
    let str = `我是一个字符串`;
    console.log(str);
    //2.反引号可以换行
    let JYS = `
    <h1>静夜思</h1>
  <p>
    <h3>李白</h3>
  </p>
  <h2>床前明月光</h2>
  <h2>疑是地上霜</h2>
  <h2>举头望明月</h2>
  <h2>低头思故乡</h2>
   `
    console.log(JYS);
    //3.变量拼接
    let name = "grace";
    let loveWho = `${name}是我最喜欢的女人`;
    console.log(loveWho);
  </script>

</html>